<template>
  <view>
    <uni-list>
      <uni-list-item v-for="(item,index) in list"
                     :key="index"
                     clickable
                     @click="itemClick(item)"
                     :title="item.className" :rightText="item.teacherName">
      </uni-list-item>
      <template v-slot:header v-if="isEmpty(list)">
        <image src="https://tj-1305380059.cos.ap-nanjing.myqcloud.com/pic/wujilu.png" mode="aspectFit" style="width: 100%; height: 600px;"></image>
      </template>
    </uni-list>
  </view>
</template>

<script>
import UniList from "../../../uni_modules/uni-list/components/uni-list/uni-list.vue";
import UniListItem from "../../../uni_modules/uni-list/components/uni-list-item/uni-list-item.vue";

export default {
  name: "classAttendanceList",
  components: {UniListItem, UniList},
  data(){
    return {
      list: [],
    }
  },
  onShow(){
    this.getList();
  },
  methods: {
    getList(){
      this.showLoadingByQuery();
      this.$api.classManage.getAppClassByDeptManager().then(res=>{
        this.hideLoading();
        this.list = res.data;
      }).catch(()=>{
        this.hideLoading();
      })
    },
    itemClick(item){
      this.goPage('/pages_main/deptManager/classAttendance/classAttendanceInfo?classId='+item.classId);
    }
  }
}

</script>

<style scoped>

</style>
